<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>

  <body>
    <script>
      const obj = {
        uname: '张三',
        age: 18,
        family: {
          baby: '小阿三',
        },
      }


      // const newObj={}

      // Object.assign(newObj, obj)
      // console.log(newObj);
      // //简单的数据类型修改
      // newObj.uname='李四'

      // console.log(newObj);
      // console.log(obj);

      // //复杂数据类型 一个地址，修改内容
      // newObj.family.baby='李小四'
      // console.log(newObj);
      // console.log(obj);

      const o={...obj}

      console.log(o);
      
      o.family.baby='小o'

      console.log(o);

    </script>
  </body>
</html>
